package zoo.order.controller;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import zoo.order.dao.OrderDao;
import zoo.order.domain.OrderCommand;

@Controller
public class OrderDetailController {
private static Log log = LogFactory.getLog(OrderDetailController.class);
	
	private OrderDao orderDao;
	
	@Autowired
	public void setMemberService(OrderDao orderDao) {
		this.orderDao = orderDao;
	}

	@RequestMapping("/main/orderdetail.do")
	public ModelAndView process(@RequestParam("or_num") int or_num) {

		if (log.isDebugEnabled()) {
			log.debug("orderDao : " + orderDao);
		}
				
		OrderCommand order = orderDao.selectOrder(or_num);
		
		ModelAndView mav = new ModelAndView();
		mav.setViewName("orderdetail");
		mav.addObject("orderdetail",order);
	
		return mav;
	}
}
